import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: '首页',
    component:Home,
    children:[
      {
        path:'yhgl',
        name:'用户管理',
        component:()=>import('../views/yiji.vue'),
        children:[
            {
              path:'yhlb',
              name:'用户列表',
              component:()=>import('../views/home/user/yhlb.vue')
            },
        ]
      },
      {
        path:'qxgl',
        name:'权限管理',
        component:()=>import('../views/yiji.vue'),
        children:[
          {
            path:'jslb',
            name:'角色列表',
            component:()=>import('../views/home/roles/jslb.vue')
          },
          {
            path:'qxlb',
            name:'权限列表',
            component:()=>import('../views/home/roles/qxlb.vue')
          },
        ]
      }, 
      {
        path:'spgl',
        name:'商品管理',
        component:()=>import('../views/yiji.vue'),
        children:[
          {
            path:'tjsp',
            name:'添加商品',
            component:()=>import('../views/home/goods/tjsp.vue')
          },
          {
            path:'splb',
            name:'商品列表',
            component:()=>import('../views/home/goods/splb.vue')
          },
          {
            path:'flcs',
            name:'分类参数',
            component:()=>import('../views/home/goods/flcs.vue'),
          },
          {
            path:'spfl',
            name:'商品分类',
            component:()=>import('../views/home/goods/spfl.vue')
          },
        ]
      },
      {
        path:'ddgl',
        name:'订单管理',
        component:()=>import('../views/yiji.vue'),
        children:[
          {
            path:'ddlb',
            name:'订单列表',
            component:()=>import('../views/home/goods/ddlb.vue')
          }
        ]
      },
      {
        path:'sjtj',
        name:'数据统计',
        component:()=>import('../views/yiji.vue'),
        children:[
          {
            path:'sjbb',
            name:'数据报表',
            component:()=>import('../views/home/goods/shuju.vue')
          }
        ]
      }
    ]
  },
  {
    path: '/login',
    name: 'login',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import( '../views/login.vue'),
  }
]

const router = new VueRouter({
  routes
})
export default router
